package com.hsylient.javase.chapter09;

import java.util.function.BiConsumer;

public class ConsumerTest {

    private int age;
    private int num;

    public static void main(String[] args) {
        ConsumerTest consumerTest = new ConsumerTest();
        consumerTest.num = 1;
        consumerTest.age = 12;
        consumerTest.testConsumer(((BiConsumer<Integer, Integer>) (integer, integer2) -> System.out.println(integer + integer2))
                .andThen((x, y) -> System.out.println(x + y)));
    }


    public static class InnerBinConsumer implements BiConsumer<Integer, Integer> {
        @Override
        public void accept(Integer integer, Integer integer2) {
            System.out.println(integer + integer2);
        }
    }


    public void testConsumer(BiConsumer<Integer, Integer> biConsumer) {
        biConsumer.accept(age, num);
    }
}
